<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
  <base href="<%=request.getContextPath()%>/">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>Create Question</title>
  <link rel="stylesheet" type="text/css" href="${surl}css/style.css" />
  <link rel="stylesheet" type="text/css" href="${surl}css/c_question.css" />
  <style type="text/css">
    .q_answer {
      float: right;
    }

  #an_x {
    position: relative;
    left: -100px;
    }
  </style>
</head>
<body>
  <c:set var="ud" value="question/update"/>
  <c:set var="ql" value="question/qPage"/>
  <c:set var="cr" value="question/create"/>

  <jsp:include page="head.jsp"></jsp:include>
  <div class="all">
    <c:choose>
      <c:when test="${type == 2}">
        <div class="nav_words">
          <a href="${ql}">Question Manage</a> >
          Question List
          > <span class="this_id">Question${qtn.id}</span>
        </div>
      </c:when>
      <c:otherwise>
        <div class="nav_words">
          <a href="${ql}">Question Manage</a> >
          Create Question
        </div>
      </c:otherwise>
    </c:choose>
    <div class="content">
      <div class="answer_inputrea">

        <c:choose>
          <c:when test="${type == 2}">
            <form id="c_form" action="${ud}" method="post">
              <input type="hidden" name="id" value="${qtn.id}" />
              <ul class="answer_ul">
                <li>
                  <span class="dec dec_id">QuestionId:</span>
                  <input class="input_group id_input" type="text" value="Question${qtn.id}" disabled>
                </li>
                <li><span class="dec dec_content">Question:</span> <textarea
                    required="required" maxlength="250"
                    class="input_group question_input" name="questionContent">${qtn.questionContent}</textarea></li>
                <li class="q_answer"><span id="an_x" class="dec dec_answer">Answer:</span><input
                  class="a_radio" type="radio" checked="checked"
                  name="correctAnswer" value="A" />A<input required="required"
                  class="input_group answer_input" maxlength="100" type="text"
                  name="answerA" value="${qtn.answerA}" /></li>
                <li class="q_answer"><input class="a_radio" type="radio"
                  name="correctAnswer" value="B" />B<input required="required"
                  class="input_group answer_input" maxlength="100" type="text"
                  name="answerB" value="${qtn.answerB}" /></li>
                <li class="q_answer"><input class="a_radio" type="radio"
                  name="correctAnswer" value="C" />C<input required="required"
                  class="input_group answer_input" maxlength="100" type="text"
                  name="answerC" value="${qtn.answerC}" /></li>
                <li class="q_answer"><input class="a_radio" type="radio"
                  name="correctAnswer" value="D" />D<input required="required"
                  class="input_group answer_input last_input" maxlength="100" type="text"
                  name="answerD" value="${qtn.answerD}" /></li>
                <li class="btn_group">
                  <input id="submit_btn" class="btn btn_question" type="submit" value="Edit" /> 
                  <a href="${ql}"><input class="btn btn_question" type="button" value="Cancel" /></a>
                </li>
              </ul>
            </form>
          </c:when>

          <c:otherwise>
            <form id="c_form" action="${cr}" method="post">
              <ul class="answer_ul">
                <li><span class="dec dec_id">QuestionId:</span><input
                  class="input_group id_input" type="text" disabled></li>
                <li><span class="dec dec_content">Question:</span> <textarea
                    required="required" maxlength="250"
                    class="input_group question_input" name="questionContent"></textarea></li>
                <li class="q_answer"><span id="an_x" class="dec dec_answer">Answer:</span><input
                  class="a_radio" type="radio" checked="checked"
                  name="correctAnswer" value="A" />A<input required="required"
                  class="input_group answer_input" type="text" maxlength="100"
                  name="answerA" /></li>
                <li class="q_answer"><input class="a_radio" type="radio"
                  name="correctAnswer" value="B" />B<input required="required"
                  class="input_group answer_input" type="text" maxlength="100"
                  name="answerB" /></li>
                <li class="q_answer"><input class="a_radio" type="radio"
                  name="correctAnswer" value="C" />C<input required="required"
                  class="input_group answer_input" type="text" maxlength="100"
                  name="answerC" /></li>
                <li class="q_answer"><input class="a_radio" type="radio"
                  name="correctAnswer" value="D" />D<input required="required"
                  class="input_group answer_input last_input" type="text" maxlength="100"
                  name="answerD" /></li>
                <li class="btn_group">
                  <input id="submit_btn" class="btn btn_question" type="submit" value="Save" />
                  <a href="${ql}"><input class="btn btn_question" type="button" value="Cancel" /></a>
                </li>
              </ul>
            </form>
          </c:otherwise>
        </c:choose>
      </div>
    </div>

  </div>
  <jsp:include page="foot.jsp"></jsp:include>
  <script src="${surl}js/jquery-1.10.2.min.js"></script>
  <script src="${surl}js/question.js"></script>
</body>
</html>